#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time: 2022/12/27 16:32
# @Author: 周健
# @Email: 907614893@qq.com
# @File：index_page.py
from selenium.webdriver.common.by import By
from pages.base_page import BasePage

class IndexPage(BasePage):
    # 定位器
    jx_locator = (By.XPATH,'//android.widget.TabWidget[@resource-id=\"android:id/tabs\"]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[1]/android.widget.ImageView[1]')
    sq_locator = (By.XPATH,'//android.widget.TabWidget[@resource-id=\"android:id/tabs\"]/android.widget.RelativeLayout[2]/android.widget.RelativeLayout[1]/android.widget.ImageView[1]')
    jia_locator = (By.XPATH,'//android.widget.TabWidget[@resource-id=\"android:id/tabs\"]/android.widget.RelativeLayout[3]/android.widget.RelativeLayout[1]')
    hws_locator = (By.XPATH,'//android.widget.TabWidget[@resource-id=\"android:id/tabs\"]/android.widget.RelativeLayout[4]/android.widget.RelativeLayout[1]/android.widget.ImageView[1]')
    wd_locator = (By.XPATH,'//android.widget.FrameLayout/android.widget.RelativeLayout[1]/android.widget.ImageView[1]')

    # 查找
    # 点击精选
    def click_jx(self):
        self.driver.find_element(*self.jx_locator).click()
    # 点击社区
    def click_sq(self):
        self.driver.find_element(*self.sq_locator).click()
    # 点击+号
    def click_jia(self):
        self.driver.find_element(*self.jia_locator).click()
    # 点击好物社
    def click_hws(self):
        self.driver.find_element(*self.hws_locator).click()
    # 点击我的
    def click_wd(self):
        self.driver.find_element(*self.wd_locator).click()